use "faces_ca_primary.dta", clear

****************
*** FIGURE 2 ***
****************

	*As it appears in the paper:
	scatter vote_difference face_from_mean [aw=totalvote_2], yli(0,lpattern(dot)) || lfit vote_difference face_from_mean [aw=totalvote_2],legend(off) scheme(lean2) yl(-.3(.1).3, nogrid) yt("Photo condition - no-photo condition vote share") xt("Appearance advantage (relative to district mean)") text(-0.2 0.87 "Slope = 0.21") text(-0.25 0.87 "(95% CI 0.10 to 0.31)")

	*With candidates labeled:
	scatter vote_difference face_from_mean, m(i) ml(last_name_d) mlabs(vsmall) mlabpos(0) yli(0,lpattern(dot)) || lfit vote_difference face_from_mean [aw=totalvote_2],legend(off) scheme(lean2) yl(-.3(.1).3, nogrid) yt("Photo condition - no-photo condition vote share") xt("Appearance advantage (relative to district mean)") text(-0.2 0.87 "Slope = 0.21") text(-0.25 0.87 "(95% CI 0.10 to 0.31)")


***************
*** TABLE 1 ***
***************

	*Column 1
	regress vote_difference face_from_mean [aw=totalvote_2]
	outreg2 using Table1, word se dec(2) replace

	*Column 2
	regress vote_difference face_from_mean [aw=totalvote_2] if inc == 0
	outreg2 using Table1, word se dec(2) append

	*Column 3
	regress vote_difference face_from_mean [aw=totalvote_2] if inc == 1
	outreg2 using Table1, word se dec(2) append
	*Column 4
	regress vote_difference face_from_mean [aw=totalvote_2] if viable==0
	outreg2 using Table1, word se dec(2) append
	*Column 5
	regress vote_difference face_from_mean [aw=totalvote_2] if viable==1
	outreg2 using Table1, word se dec(2) append	
	*Column 6
	regress vote_difference face_from_mean [aw=totalvote_2] if pid=="Democratic"
	outreg2 using Table1, word se dec(2) append	
	*Column 7
	regress vote_difference face_from_mean [aw=totalvote_2] if pid=="Republican"
	outreg2 using Table1, word se dec(2) append	
	*Column 8
	regress vote_difference face_from_mean inc white male [aw=totalvote_2]
	outreg2 using Table1, word se dec(2) append	
	*Columns 9 & 10: Is the effect driven by candidates looking the part or playing the clown???
	
	*First, look at distribution of "face_min":
	sum face_min, d
		* 0.3846154 = 25th pctile of face_min
		* 0.4590909 = 75th pctile of face_min
		
		*Column 9
		regress vote_difference face_from_mean if face_min <= 0.3846154 [aw=totalvote_2]
		outreg2 using Table1, word se dec(2) append
		*Column 10
		regress vote_difference face_from_mean if face_min > 0.3846154 [aw=totalvote_2]
		outreg2 using Table1, word se dec(2) append
